#include "Collider.h"

#include "Scene/Scene.h"
#include "Physics/PhysicalScene.h"
#include "Physics/RigidBody.h"

void RCollider::OnBeginPlay()
{
    Super::OnBeginPlay();

    GetScene()->GetPhysicalScene()->RegisterCollider(this);
}

void RCollider::OnEndPlay()
{
    GetScene()->GetPhysicalScene()->UnregisterCollider(this);

    Super::OnEndPlay();
}

TSharedObjectPtr<RRigidBody> RCollider::GetRigidBody()
{
    return GetNode()->GetComponent<RRigidBody>();
}
